aboutsummaryrefslogtreecommitdiffstats
path: root/src/pages/thematique/[slug].tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/pages/thematique/[slug].tsx')
-rw-r--r--src/pages/thematique/[slug].tsx9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/pages/thematique/[slug].tsx b/src/pages/thematique/[slug].tsx
index 75f33ff..9955089 100644
--- a/src/pages/thematique/[slug].tsx
+++ b/src/pages/thematique/[slug].tsx
@@ -3,7 +3,7 @@ import PostPreview from '@components/PostPreview/PostPreview';
import { t } from '@lingui/macro';
import { NextPageWithLayout } from '@ts/types/app';
import { TopicPreview, ThematicProps } from '@ts/types/taxonomies';
-import { loadTranslation } from '@utils/helpers/i18n';
+import { defaultLocale, loadTranslation } from '@utils/helpers/i18n';
import { GetStaticPaths, GetStaticProps, GetStaticPropsContext } from 'next';
import { ParsedUrlQuery } from 'querystring';
import styles from '@styles/pages/Page.module.scss';
@@ -141,10 +141,8 @@ interface PostParams extends ParsedUrlQuery {
export const getStaticProps: GetStaticProps = async (
context: GetStaticPropsContext
) => {
- const translation = await loadTranslation(
- context.locale!,
- process.env.NODE_ENV === 'production'
- );
+ const { locale } = context;
+ const translation = await loadTranslation(locale || defaultLocale);
const { slug } = context.params as PostParams;
const thematic = await getThematicBySlug(slug);
const breadcrumbTitle = thematic.title;
@@ -152,6 +150,7 @@ export const getStaticProps: GetStaticProps = async (
return {
props: {
breadcrumbTitle,
+ locale,
thematic,
translation,
},